﻿package
{
	import flash.display.MovieClip;
	
	import src.*;
	import flash.net.SharedObject;
	
	
	public class Bat extends MovieClip
	{
		public var hud:HUD;
		public var game:Game;
		public var game_files:SharedObject;
		private var msgMenu:MsgMenu;
		
		public function Bat()
		{
			game_files = SharedObject.getLocal("BatARI");
			if (game_files.data.bestScore==null){game_files.data.bestScore=0}
			
			displayMenu("Instructions");
			
		}
		
		public function displayMenu(type:String){
			msgMenu= new MsgMenu(this,type);
			addChild(msgMenu);
			msgMenu.x = 640;
			msgMenu.y = 360;
		}
		
		public function initGame(){
			if (msgMenu!=null) {removeChild(msgMenu)};
			if (game!=null){removeChild(game)};
			if (hud!=null){removeChild(hud)};
			
			game= new Game(this);
			addChild(game);
			game.scaleX=0.55;
			game.scaleY=0.55;
			game.x = 640;
			game.y = 360;
			
			hud= new HUD(this);
			addChild(hud);
			hud.x = 640;
			hud.y = 355;
		}
		
	}
}